<template>
	<view>
	<free-nav-bar showback showright="true" title="发布朋友圈">
	
		<view slot="right" class="main-bg-color rounded mr-3 px-2 py-1" @click="saveback">
			<text class="font text-white">保存</text>
	
	
		</view>
	</free-nav-bar>
	<textarea placeholder="这一刻想法" class="p-3 font-md mb-3"></textarea>
	<!-- <view class="flex flex-wrap">
		<view class="flex align-center justify-center mb-3" style="width: 230rpx;" v-for="item in imageList" >
			<image src="../../../../static/lyc.jpg" class="bg-light rounded" mode="" style="width: 220rpx;height: 220rpx;"></image>
		</view>
		<view v-if="imageList.length<9" @click="chooseimage"  class="flex align-center justify-center" style="width: 230rpx;" >
			<view class="flex align-center justify-center bg-light rounded" style="width: 220rpx;height: 220rpx;">
				<text class="text-light-muted" style="font-size: 80rpx;">+</text>
			</view>
		</view>
	</view> -->
	<free-upload-image v-if="type == 'image'"  @deleteee="shanchu":data="imageList" @upload="upload"></free-upload-image>
<view class="" v-if="type == 'video'">
	<view class="flex align-center justify-center bg-light"  v-if="!video" hover-class="bg-hover-light" @click="uploadvideo">
		<text class="text-muted" style="font-size: 100rpx;">+</text>
		
	</view>	
		<video :src="video" v-if="video" controls style="width: 100%;"></video>
		<view @click="uploadvideo" class="" v-if="video" class="my-3 flex justify-center align-center bg-light" hover-class="bg-hover-light" style="height: 100rpx;">
  <text class="font text-muted">点击切换视频</text> 			
		</view>
</view>


	<free-list-item title="所在位置"  showright isshowjt>
		<text class="iconfont font-lg py-2" slot="icon">&#xe647;</text>
		<view class="" slot="right">
			<text class="font-md" 
				>公开</text>
					
		</view>

	</free-list-item>
	<free-list-item title="提醒谁看"  showright isshowjt>
		<text class="iconfont font-lg py-2" slot="icon">&#xe611;</text>
		<view class="position-relative p-1" slot="right">

		</view>
	</free-list-item>
	<free-list-item title="谁可以看"  showright isshowjt>
		<text class="iconfont font-lg py-2" slot="icon">&#xe611;</text>
		<view class="position-relative p-1" slot="right">

		</view>
	</free-list-item>
	</view>
</template>

<script>
	import freeNavBar from "@/components/free-ui/free-nav-bar.vue"
		import freeUploadImage from "@/components/free-ui/free-upload-image.vue"
	import freeListItem from "@/components/free-ui/free-list-item.vue"
	
	export default {
		components:{
			freeNavBar,
			freeUploadImage,
			freeListItem
		},
		data() {
			return {
			imageList:[],	
			video:"",
			type:""
			}
		},
		onLoad(e) {
			console.log(e,"e");
	this.type=e.type
		},
		methods: {
			uploadvideo(){
				uni.chooseVideo({
					maxDuration:10,
					success: (res) => {
					this.video=res.tempFilePath	
					}
				})
			},
			shanchu(e){
				this.imageList=e
				
			},
			upload(e){
				console.log(e,"eeeee")
				this.imageList=e
			},
			chooseimage(){
				uni.chooseImage({
					count:9-this.imageList.length,
					sizeType:['compressed'],
					success: (res) => {
	this.imageList=[...this.imageList, ...res.tempFilePaths]
	console.log(this.imageList)
					}
				})
			}
		}
	}
</script>

<style>

</style>
